home *** CD-ROM | disk | FTP | other *** search
- From: kurisuto@BACH.UDEL.EDU ("Sean J. Crist")
- Subject: Free Code: Watch Cursors
- Date: 18 Sep 92 02:30:01 GMT
-
-
- The following free code is nothing particularly complicated or
- unusual; it simply handles the work involved in showing watch cursors,
- either with spinning or non-spinning hands. I'm posting it here because
- it may be helpful to new programmers, or
- because it might save someone else the time of writing it over again.
- This code was written in Think Pascal 4.0.
-
- How to use this code:
- 1. Use ResEdit to copy the seven CURS resources from the Finder into your
- application's resource file. I lifted mine from 6.1.5 where they were
- numbered beginning at 257. I'm not sure whether or not these resource
- numbers are the same under all
- versions of the Finder; if yours are different, you will have to either
- change the resource numbers or the code below.
- Also, I don't know how Apple feels about people stealing their
- cursors. However, since these seven CURS resources are a standard part of
- the user interface, and since they are a minor part of the Finder, I doubt
- that Apple is going to sue you for
- using them.
-
- 2. Include the global variables in the code below in your program's
- global declarations.
-
- 3. When your program initializes itself on startup, it should call
- InitWatch once. Alternately, you could eliminate this routine and paste
- its one line of code into your own initialize routine.
-
- 4. To show a simple still watch, call ShowWatch. This routine is
- functionally equivalent to InitCursor.
-
- 5. To make the hands of the watch actually spin, don't call ShowWatch.
- Instead, start the watch spinning by calling StartSpinningWatch. While
- you are doing your time-consuming processing, call SpinWatch as often as
- possible (perhaps by including it in
- some inner processing loop). SpinWatch takes care of the timing involved
- in spinning the watch hands; all you have to do is call it as often as
- possible.
-
- 6. When you are finished spinning the watch hands, be sure to call
- StopSpinningWatch. This deallocates the memory associated with the watch
- cursors.
-
- 7. This code spins the watch handle every 30 ticks (once every half
- second). To change this speed, edit the figure 30 in the SpinWatch
- routine. (I don't know whether Apple has established any guideline for
- how often a cursor should spin.)
-
- Please send bug reports, praise, etc. to kurisuto@bach.udel.edu. I hope
- this code is useful to somebody.
-